package com.ruoyi.land.service.impl;

import java.util.List;

import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.land.mapper.ArgoLandMapper;
import com.ruoyi.land.domain.ArgoLand;
import com.ruoyi.land.service.IArgoLandService;

/**
 * 地块信息Service业务层处理
 * 
 * @author qhr
 * @date 2024-02-20
 */
@Service
public class ArgoLandServiceImpl implements IArgoLandService 
{
    @Autowired
    private ArgoLandMapper argoLandMapper;

    /**
     * 查询地块信息
     * 
     * @param id 地块信息主键
     * @return 地块信息
     */
    @Override
    public ArgoLand selectArgoLandById(Long id)
    {
        return argoLandMapper.selectArgoLandById(id);
    }

    /**
     * 查询地块信息列表
     * 
     * @param argoLand 地块信息
     * @return 地块信息
     */
    @Override
    public List<ArgoLand> selectArgoLandList(ArgoLand argoLand)
    {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        argoLand.setDeptId(loginUser.getUser().getDeptId());
        List<ArgoLand> result = argoLandMapper.selectArgoLandList(argoLand);
        return result;
    }

    /**
     * 新增地块信息
     * 
     * @param argoLand 地块信息
     * @return 结果
     */
    @Override
    public int insertArgoLand(ArgoLand argoLand)
    {
        argoLand.setCreateTime(DateUtils.getNowDate());
        return argoLandMapper.insertArgoLand(argoLand);
    }

    /**
     * 修改地块信息
     * 
     * @param argoLand 地块信息
     * @return 结果
     */
    @Override
    public int updateArgoLand(ArgoLand argoLand)
    {
        argoLand.setUpdateTime(DateUtils.getNowDate());
        return argoLandMapper.updateArgoLand(argoLand);
    }

    /**
     * 批量删除地块信息
     * 
     * @param ids 需要删除的地块信息主键
     * @return 结果
     */
    @Override
    public int deleteArgoLandByIds(Long[] ids)
    {
        return argoLandMapper.deleteArgoLandByIds(ids);
    }

    /**
     * 删除地块信息信息
     * 
     * @param id 地块信息主键
     * @return 结果
     */
    @Override
    public int deleteArgoLandById(Long id)
    {
        return argoLandMapper.deleteArgoLandById(id);
    }
}
